package com.boang.nio;

import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

/*
  @author: 13813
  @date: 2024/12/13 10:11
*/
public class FilePaths {
    public static void main(String[] args) throws IOException {
//        Path path = Paths.get("C:\\Users\\13813\\Desktop\\jar\\a");
//        Files.createDirectory(path);

        //创建文件a.txt
//        Path file = Paths.get("C:\\Users\\13813\\Desktop\\jar\\a\\a.txt");
//        Files.createFile(file);

        //写内容到a.txt
        Path file = Paths.get("C:\\Users\\13813\\Desktop\\jar\\a\\a.txt");
//        BufferedWriter bufferedWriter = Files.newBufferedWriter(file);
//        bufferedWriter.write("abc");
//        bufferedWriter.close();

        //复制
        Path b = Paths.get("C:\\Users\\13813\\Desktop\\jar\\a\\b.txt");
        Files.copy(file, b);


    }
}
